package com.xuelang.pipeline.artifact.app.harborv2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xuelang.pipeline.artifact.app.harborv2.xo.CVEAllowlist;
import com.xuelang.pipeline.artifact.app.harborv2.xo.ProjectMetadata;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author xiwen.zxg
 * @since 2024/7/11
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateProjectRequest {

    /**
     * The CVE allowlist of the project.
     */
    @JsonProperty("cve_allowlist")
    private CVEAllowlist cveAllowlist;
    /**
     * The metadata of the project.
     */
    @JsonProperty("metadata")
    private ProjectMetadata metadata;
    /**
     * The name of the project.
     */
    @JsonProperty("project_name")
    private String projectName;
    /**
     * deprecated, reserved for project creation in replication
     */
    //提供swaggerApi文档与HarborV2.11.0-70255684接口源码不一致，按实际调用测试请求，已将该字段放到metadata中
    //@JsonProperty("public")
    //private Boolean requestPublic;
    /**
     * The ID of referenced registry when creating the proxy cache project
     */
    @JsonProperty("registry_id")
    private String registryId;
    /**
     * The storage quota of the project.
     */
    //提供swaggerApi文档与HarborV2.11.0-70255684接口源码不一致，按实际调用测试请求，该字段值设置为30后，当Push镜像包时，
    // 会出现403（failed commit on ref "manifest-sha256:b09a3ddd318a4759009c82296f285c72561a564725862be2a48c958c216dbde7": unexpected status from PUT request to https://testharbor.com/v2/system-hhh-docker/nw-devops-pipeline/manifests/2.0-SNAPSHOT: 403 Forbidden），
    // TODO: 实际上应该存储配置限额，防止无上限申请资源，此处需要优化
    @JsonProperty("storage_limit")
    private Long storageLimit;

}
